package com.caimiao.miao.library.bluetooth;

import android.bluetooth.BluetoothDevice;
import android.os.ParcelUuid;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class BTDevice {
    private List<UUID> uuid;
    private String name;
    private String address;
    private int type;
    private int state;

    public BTDevice(BluetoothDevice device) {
        setAddress(device.getAddress());
        setState(device.getBondState());
        setType(device.getType());
        setName(device.getName());
        setUuid(device.getUuids());
    }

    public BTDevice(List<UUID> uuid, String name) {
        this.uuid = uuid;
        this.name = name;
    }

    public List<UUID> getUuid() {
        return uuid;
    }

    public void setUuid(List<UUID> uuid) {
        this.uuid = uuid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public void setUuid(ParcelUuid[] uuids) {
        int length = uuids == null ? 0 : uuids.length;
        if (uuid == null) uuid = new ArrayList<>();
        for (int i = 0; i < length; i++) {
            uuid.add(uuids[i].getUuid());
        }
    }
}
